package com.hightrast.service.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hightrast.service.api.domain.qo.rastVendor.QueryRastVendorsQo;
import com.hightrast.service.api.domain.vo.rastVendor.QueryRastVendorsVo;
import com.hightrast.service.api.entity.RastVendor;
import com.hightrast.service.mapper.RastVendorMapper;
import com.hightrast.service.service.IRastUserVendorService;
import com.hightrast.service.service.IRastVendorService;
import com.hightrast.service.util.TreeUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 品牌表 服务实现类
 * </p>
 *
 * @author hx
 * @since 2025-01-11
 */
@Service
public class RastVendorServiceImpl extends ServiceImpl<RastVendorMapper, RastVendor> implements IRastVendorService {

    @Resource
    IRastUserVendorService userVendorService;

    /**
     * 获取品牌列表
     * @return
     */
    @Override
    public List<QueryRastVendorsVo> queryVendors(QueryRastVendorsQo qo) {
       return this.baseMapper.selectVendors(qo).stream().filter(TreeUtils.distinctByKey(QueryRastVendorsVo::getVendorId)).collect(Collectors.toList());
    }

}
